<template>
  <div class="goods-components" @click="router.push({path: '/product', query:{goods_id: props.goods?.goods_id}})">
    <van-image
     width="100%"
     fit="contain"
     :src="props.goods?.goods_thumb"
    />
    <div class="goods-name">{{ props.goods?.goods_name }}</div>
    <div class="goods-desc">{{ props.goods?.goods_desc }}</div>
    <div class="goods-price">￥ {{ props.goods?.price }}</div>
  </div>
</template>

<script setup lang="ts">
  const router = useRouter();
  const props = defineProps({
    goods: Object
  });
</script>

<style scoped lang="less">
  .goods-components{
    background-color: #fff;
    .goods-name{
      margin-top: 10px;
      font-size: 13px;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
      text-overflow: ellipsis;
      -webkit-line-clamp: 2;
      line-height: 24px;
      height: 48px;
      padding: 0 10px;
    }
    .goods-desc{
      margin-top: 5px;
      font-size: 12px;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
      text-overflow: ellipsis;
      -webkit-line-clamp: 2;
      line-height: 16px;
      color: #999;
      height: 32px;
      padding: 0 10px;
    }
    .goods-price{
      margin-top: 5px;
      color: #5881cf;
      font-weight: bold;
      padding: 0 10px 20px;
    }
  }
</style>